<!doctype html>



  


<html class="theme-next pisces use-motion" lang="zh-CN">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>






<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />



  <meta name="google-site-verification" content="ojuCmbEUKDUtduqtuqs4jjwa-kJTF2PAJM-YEfGBpaU" />







  <meta name="baidu-site-verification" content="Q2zf7SFGkD" />




  <meta name="360-site-verification" content="06fcdce1b9c04508be6260fe40d4fcd0" />




  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="hexo,教程," />





  <link rel="alternate" href="/atom.xml" title="WillXue's Blog" type="application/atom+xml" />




  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta property="og:type" content="article">
<meta property="og:title" content="Hexo系列教程之四：hexo的配置和优化">
<meta property="og:url" content="http://willxue.top/blog/Hexo系列教程之四：hexo的配置和优化-20160324/index.html">
<meta property="og:site_name" content="WillXue's Blog">
<meta property="og:image" content="http://7xrz9n.com1.z0.glb.clouddn.com/hexo41.png">
<meta property="og:image" content="http://7xrz9n.com1.z0.glb.clouddn.com/hexo42.png">
<meta property="og:image" content="http://7xrz9n.com1.z0.glb.clouddn.com/hexo43.png">
<meta property="og:image" content="http://7xrz9n.com1.z0.glb.clouddn.com/hexo44.png">
<meta property="og:image" content="http://7xrz9n.com1.z0.glb.clouddn.com/hexo45.png">
<meta property="og:image" content="http://7xrz9n.com1.z0.glb.clouddn.com/hexo46.png">
<meta property="og:updated_time" content="2016-06-11T04:03:21.836Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Hexo系列教程之四：hexo的配置和优化">
<meta name="twitter:image" content="http://7xrz9n.com1.z0.glb.clouddn.com/hexo41.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://willxue.top/blog/Hexo系列教程之四：hexo的配置和优化-20160324/"/>





  <title> Hexo系列教程之四：hexo的配置和优化 | WillXue's Blog </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?0140105715a4b89c631d1e11b622c4ad";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>










  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">WillXue's Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">一个好高骛远的码农</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-commonweal">
          <a href="/404.html" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br />
            
            公益404
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://willxue.top/blog/Hexo系列教程之四：hexo的配置和优化-20160324/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="willxue">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="http://willxue.ufile.ucloud.com.cn/logo.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="WillXue's Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                Hexo系列教程之四：hexo的配置和优化
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2016-03-24T22:42:17+08:00">
                2016-03-24
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/hexo/" itemprop="url" rel="index">
                    <span itemprop="name">hexo</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-comment-o"></i>
              </span>
              
                <a href="/blog/Hexo系列教程之四：hexo的配置和优化-20160324/#SOHUCS" itemprop="discussionUrl">
                  <span id="changyan_count_unit" class="post-comments-count hc-comment-count" data-xid="blog/Hexo系列教程之四：hexo的配置和优化-20160324/" itemprop="commentsCount"></span>
                </a>
              
            
          

          
          
             <span id="/blog/Hexo系列教程之四：hexo的配置和优化-20160324/" class="leancloud_visitors" data-flag-title="Hexo系列教程之四：hexo的配置和优化">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">阅读次数 </span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <p><img src="http://7xrz9n.com1.z0.glb.clouddn.com/hexo41.png" alt="willxue"><br><a id="more"></a></p>
<h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><hr>
<p>前面写了点hexo主题next的一些简单配置，怎奈本人实在太懒，言语表达能力欠缺，写的文章质量太低，态度也有点问题，希望自己能慢慢坚持，努力改正，争取每天都写点。</p>
<h1 id="正文"><a href="#正文" class="headerlink" title="正文"></a>正文</h1><hr>
<blockquote>
<p>下面进入正题，现在很多主题已经把很多功能都合并进去，所以操作起来相对简单一些了，以下介绍包含但不限于<code>next</code>主题。</p>
</blockquote>
<h2 id="多说评论"><a href="#多说评论" class="headerlink" title="多说评论"></a>多说评论</h2><p>给站点加入多说评论功能，基本所有主题都集成了，说一下基本操作，以及一些个性化设置。</p>
<h3 id="添加多说评论"><a href="#添加多说评论" class="headerlink" title="添加多说评论"></a>添加多说评论</h3><ol>
<li><p>打开<a href="http://duoshuo.com/" target="_blank" rel="external">多说</a>首页,点 <strong>我要安装</strong> ，登陆多说（微博或qq快捷登录），创建站点。<br><img src="http://7xrz9n.com1.z0.glb.clouddn.com/hexo42.png" alt="willxue"></p>
</li>
<li><p>按下图进行输入创建评论站点。<br><img src="http://7xrz9n.com1.z0.glb.clouddn.com/hexo43.png" alt="willxue"></p>
</li>
<li><p>创建完以后进入管理后台，在左侧菜单栏里找到工具，右侧代码里看到<code>short_name</code>，也就是刚才输入的多说域名。<br><img src="http://7xrz9n.com1.z0.glb.clouddn.com/hexo44.png" alt="willxue"></p>
</li>
<li><p>打开 <code>主题配置文件</code>，找到 <code>duoshuo_shortname</code>，写到后面。不同主题可能名字不一样，操作都是一样的。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">duoshuo_shortname: imwillxue</div></pre></td></tr></table></figure>
</li>
</ol>
<h3 id="修改评论框CSS样式"><a href="#修改评论框CSS样式" class="headerlink" title="修改评论框CSS样式"></a>修改评论框CSS样式</h3><p>CSS好的可以自己写，详见<a href="http://dev.duoshuo.com/docs/4ff1cfd0397309552c000017" target="_blank" rel="external">多说文档</a>。当然google一堆，我的就是google的，前端太烂。下面是我的代码，具体样式评论查看。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div><div class="line">118</div><div class="line">119</div><div class="line">120</div><div class="line">121</div><div class="line">122</div><div class="line">123</div><div class="line">124</div><div class="line">125</div><div class="line">126</div><div class="line">127</div><div class="line">128</div><div class="line">129</div><div class="line">130</div><div class="line">131</div><div class="line">132</div><div class="line">133</div><div class="line">134</div><div class="line">135</div><div class="line">136</div><div class="line">137</div><div class="line">138</div><div class="line">139</div><div class="line">140</div><div class="line">141</div><div class="line">142</div><div class="line">143</div><div class="line">144</div><div class="line">145</div><div class="line">146</div><div class="line">147</div><div class="line">148</div><div class="line">149</div><div class="line">150</div><div class="line">151</div><div class="line">152</div><div class="line">153</div><div class="line">154</div><div class="line">155</div><div class="line">156</div><div class="line">157</div><div class="line">158</div><div class="line">159</div><div class="line">160</div><div class="line">161</div><div class="line">162</div><div class="line">163</div><div class="line">164</div><div class="line">165</div><div class="line">166</div><div class="line">167</div><div class="line">168</div><div class="line">169</div><div class="line">170</div><div class="line">171</div><div class="line">172</div><div class="line">173</div></pre></td><td class="code"><pre><div class="line">/*Head Start*/</div><div class="line">#ds-thread #ds-reset ul.ds-comments-tabs li.ds-tab a.ds-current &#123;</div><div class="line">    border: 0px;</div><div class="line">    color: #6D6D6B;</div><div class="line">    text-shadow: none;</div><div class="line">    background: #F3F3F3;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset .ds-highlight &#123;</div><div class="line">    font-family: Microsoft YaHei, &quot;Helvetica Neue&quot;, Helvetica, Arial, Sans-serif;</div><div class="line">    ;font-size: 100%;</div><div class="line">    color: #6D6D6B !important;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset ul.ds-comments-tabs li.ds-tab a.ds-current:hover &#123;</div><div class="line">    color: #696a52;</div><div class="line">    background: #F2F2F2;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset a.ds-highlight:hover &#123;</div><div class="line">    color: #696a52 !important;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread &#123;</div><div class="line">    padding-left: 15px;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset li.ds-post,#ds-thread #ds-reset #ds-hot-posts &#123;</div><div class="line">    overflow: visible;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset .ds-post-self &#123;</div><div class="line">    padding: 10px 0 10px 10px;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset li.ds-post,#ds-thread #ds-reset .ds-post-self &#123;</div><div class="line">    border: 0 !important;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-reset .ds-avatar, #ds-thread #ds-reset ul.ds-children .ds-avatar &#123;</div><div class="line">    top: 15px;</div><div class="line">    left: -20px;</div><div class="line">    padding: 5px;</div><div class="line">    width: 36px;</div><div class="line">    height: 36px;</div><div class="line">    box-shadow: -1px 0 1px rgba(0,0,0,.15) inset;</div><div class="line">    border-radius: 46px;</div><div class="line">    background: #FAFAFA;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread .ds-avatar a &#123;</div><div class="line">    display: inline-block;</div><div class="line">    padding: 1px;</div><div class="line">    width: 32px;</div><div class="line">    height: 32px;</div><div class="line">    border: 1px solid #b9baa6;</div><div class="line">    border-radius: 50%;</div><div class="line">    background-color: #fff !important;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread .ds-avatar a:hover &#123;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread .ds-avatar &gt; img &#123;</div><div class="line">    margin: 2px 0 0 2px;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset .ds-replybox &#123;</div><div class="line">    box-shadow: none;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset ul.ds-children .ds-replybox.ds-inline-replybox a.ds-avatar,</div><div class="line">#ds-reset .ds-replybox.ds-inline-replybox a.ds-avatar &#123;</div><div class="line">    left: 0;</div><div class="line">    top: 0;</div><div class="line">    padding: 0;</div><div class="line">    width: 32px !important;</div><div class="line">    height: 32px !important;</div><div class="line">    background: none;</div><div class="line">    box-shadow: none;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-reset .ds-replybox.ds-inline-replybox a.ds-avatar img &#123;</div><div class="line">    width: 32px !important;</div><div class="line">    height: 32px !important;</div><div class="line">    border-radius: 50%;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-reset .ds-replybox a.ds-avatar,</div><div class="line">#ds-reset .ds-replybox .ds-avatar img &#123;</div><div class="line">    padding: 0;</div><div class="line">    width: 32px !important;</div><div class="line">    height: 32px !important;</div><div class="line">    border-radius: 5px;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-reset .ds-avatar img &#123;</div><div class="line">    width: 32px !important;</div><div class="line">    height: 32px !important;</div><div class="line">    border-radius: 32px;</div><div class="line">    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);</div><div class="line">    -webkit-transition: .8s all ease-in-out;</div><div class="line">    -moz-transition: .4s all ease-in-out;</div><div class="line">    -o-transition: .4s all ease-in-out;</div><div class="line">    -ms-transition: .4s all ease-in-out;</div><div class="line">    transition: .4s all ease-in-out;</div><div class="line">&#125;</div><div class="line"></div><div class="line">.ds-post-self:hover .ds-avatar img &#123;</div><div class="line">    -webkit-transform: rotateX(360deg);</div><div class="line">    -moz-transform: rotate(360deg);</div><div class="line">    -o-transform: rotate(360deg);</div><div class="line">    -ms-transform: rotate(360deg);</div><div class="line">    transform: rotate(360deg);</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset .ds-comment-body &#123;</div><div class="line">    -webkit-transition-delay: initial;</div><div class="line">    -webkit-transition-duration: 0.4s;</div><div class="line">    -webkit-transition-property: all;</div><div class="line">    -webkit-transition-timing-function: initial;</div><div class="line">    background: #F7F7F7;</div><div class="line">    padding: 15px 15px 15px 47px;</div><div class="line">    border-radius: 5px;</div><div class="line">    box-shadow: #B8B9B9 0 1px 3px;</div><div class="line">    border: white 1px solid;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset ul.ds-children .ds-comment-body &#123;</div><div class="line">    padding-left: 15px;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset .ds-comment-body p &#123;</div><div class="line">    color: #787968;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset .ds-comments &#123;</div><div class="line">    border-bottom: 0px;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset .ds-powered-by &#123;</div><div class="line">    display: none;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset .ds-comments a.ds-user-name &#123;</div><div class="line">    font-weight: normal;</div><div class="line">    color: #3D3D3D !important;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset .ds-comments a.ds-user-name:hover &#123;</div><div class="line">    color: #D32 !important;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset #ds-bubble &#123;</div><div class="line">    display: none !important;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset #ds-hot-posts &#123;</div><div class="line">    border: 0;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-reset #ds-hot-posts .ds-gradient-bg &#123;</div><div class="line">    background: none;</div><div class="line">&#125;</div><div class="line"></div><div class="line">#ds-thread #ds-reset .ds-comment-body:hover &#123;</div><div class="line">    background-color: #F1F1F1;</div><div class="line">    -webkit-transition-delay: initial;</div><div class="line">    -webkit-transition-duration: 0.4s;</div><div class="line">    -webkit-transition-property: all;</div><div class="line">    -webkit-transition-timing-function: initial;</div><div class="line">&#125;</div><div class="line">/*Head End*/</div></pre></td></tr></table></figure></p>
<p>打开多说管理后台，把上面的代码复制进去。<br><img src="http://7xrz9n.com1.z0.glb.clouddn.com/hexo45.png" alt="willxue"></p>
<h3 id="显示UA及博主"><a href="#显示UA及博主" class="headerlink" title="显示UA及博主"></a>显示UA及博主</h3><p>显示ua功能，next主题已经集成了，只需要在配置文件设置一下就行了，效果看下图。<br><img src="http://7xrz9n.com1.z0.glb.clouddn.com/hexo46.png" alt="willxue"></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">duoshuo_info:</div><div class="line">  ua_enable: true  #是否显示ua</div><div class="line">  admin_enable: true #是否显示博主</div><div class="line">  user_id: 6262178932196377345  #多说用户id</div><div class="line">  admin_nickname: 神 #博主昵称自定义</div></pre></td></tr></table></figure>
<p><strong>注： 多说id就是打开多说个人中心<a href="http://duoshuo.com/settings/" target="_blank" rel="external">http://duoshuo.com/settings/</a>，点击你的用户名地址会出现一串数字就是多说id。</strong></p>
<h4 id="其他方法"><a href="#其他方法" class="headerlink" title="其他方法"></a>其他方法</h4><p>对于很多没有集成这个功能的主题，可以参考一下文章或插件。<br>多说UA插件 - <a href="http://gerald.top/code/duoshuo-ua" target="_blank" rel="external">http://gerald.top/code/duoshuo-ua</a><br>ua-parser-js - <a href="https://github.com/faisalman/ua-parser-js" target="_blank" rel="external">https://github.com/faisalman/ua-parser-js</a><br>另外，还有本地化embed.js的，有兴趣的可以google一下。</p>
<h2 id="RSS和sitemap"><a href="#RSS和sitemap" class="headerlink" title="RSS和sitemap"></a>RSS和sitemap</h2><ol>
<li><p>安装RSS和sitemap插件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">npm install hexo-generator-feed --save</div><div class="line">npm install hexo-generator-sitemap --save</div></pre></td></tr></table></figure>
</li>
<li><p>开启RSS和sitemap功能，编辑站点配置文件 <code>hexo/_config.yml</code></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">feed: </div><div class="line">  type: atom  #feed 类型 </div><div class="line">  path: atom.xml  #rss 路径 </div><div class="line">  limit: 20  #在 rss 中最多生成的文章数(0显示所有)</div></pre></td></tr></table></figure>
</li>
</ol>
<p>NexT 中 RSS 有三个设置选项，满足特定的使用场景。 更改 <code>主题配置文件</code>，设定 <code>rss</code> 字段的值：</p>
<ul>
<li>false：禁用 RSS，不在页面上显示 RSS 连接。</li>
<li>留空：使用 Hexo 生成的 Feed 链接。 </li>
<li>具体的链接地址：适用于已经烧制过 Feed 的情形。</li>
</ul>
<p>我们这里留空就行了。</p>
<p><strong>将生成出来的sitemap.xml文件提交给搜索引擎，后面介绍。</strong></p>
<h2 id="腾讯公益404页面"><a href="#腾讯公益404页面" class="headerlink" title="腾讯公益404页面"></a>腾讯公益404页面</h2><p>在 <code>hexo/source</code> 文件夹下新建404.html，推荐使用腾讯公益404。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line">&lt;!DOCTYPE html&gt;</div><div class="line">&lt;html&gt;</div><div class="line"></div><div class="line">	&lt;head&gt;</div><div class="line">		&lt;meta charset=&quot;UTF-8&quot;&gt;</div><div class="line">		&lt;title&gt;404&lt;/title&gt;</div><div class="line">	&lt;/head&gt;</div><div class="line"></div><div class="line">	&lt;body&gt;</div><div class="line">		&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.qq.com/404/search_children.js&quot; </div><div class="line">		charset=&quot;utf-8&quot; homePageUrl=&quot;http://willxue.top&quot; homePageName=&quot;我的博客&quot;&gt;&lt;/script&gt;</div><div class="line">	&lt;/body&gt;</div><div class="line"></div><div class="line">&lt;/html&gt;</div></pre></td></tr></table></figure></p>
<h1 id="常见错误"><a href="#常见错误" class="headerlink" title="常见错误"></a>常见错误</h1><hr>
<ul>
<li>修改配置文件时注意 <code>YAML</code> 语法，参数冒号: 后一定要留空格</li>
<li>中文乱码请修改文件编码格式为UTF-8</li>
<li>GitHub同步慢或者失败请使用翻墙代理加速</li>
</ul>
<h1 id="最后"><a href="#最后" class="headerlink" title="最后"></a>最后</h1><hr>
<p>不总结了，且看下回分解。</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div>请我喝杯咖啡！</div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="http://7xrz9n.com1.z0.glb.clouddn.com/wechatpay.png" alt="willxue WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
        <div id="alipay" style="display: inline-block">
          <img id="alipay_qr" src="http://7xrz9n.com1.z0.glb.clouddn.com/alipay.png" alt="willxue Alipay"/>
          <p>支付宝打赏</p>
        </div>
      
    </div>
  </div>


      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/hexo/" rel="tag"># hexo</a>
          
            <a href="/tags/教程/" rel="tag"># 教程</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/Hexo系列教程之三：next主题的配置和优化-20160322/" rel="next" title="Hexo系列教程之三：next主题的配置和优化">
                <i class="fa fa-chevron-left"></i> Hexo系列教程之三：next主题的配置和优化
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/Hexo系列教程之五：hexo博客同时托管在github和coding-20160325/" rel="prev" title="Hexo系列教程之五：hexo博客同时托管在github和coding">
                Hexo系列教程之五：hexo博客同时托管在github和coding <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="SOHUCS"></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="http://willxue.ufile.ucloud.com.cn/logo.png"
               alt="willxue" />
          <p class="site-author-name" itemprop="name">willxue</p>
           
              <p class="site-description motion-element" itemprop="description">晚上少吃点？</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">14</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">6</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">10</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        
          <div class="feed-link motion-element">
            <a href="/atom.xml" rel="alternate">
              <i class="fa fa-rss"></i>
              RSS
            </a>
          </div>
        

        <div class="links-of-author motion-element">
          
        </div>

        
        
          <div class="cc-license motion-element" itemprop="license">
            <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" target="_blank">
              <img src="/images/cc-by-nc-sa.svg" alt="Creative Commons" />
            </a>
          </div>
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#前言"><span class="nav-text">前言</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#正文"><span class="nav-text">正文</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#多说评论"><span class="nav-text">多说评论</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#添加多说评论"><span class="nav-text">添加多说评论</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#修改评论框CSS样式"><span class="nav-text">修改评论框CSS样式</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#显示UA及博主"><span class="nav-text">显示UA及博主</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#其他方法"><span class="nav-text">其他方法</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#RSS和sitemap"><span class="nav-text">RSS和sitemap</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#腾讯公益404页面"><span class="nav-text">腾讯公益404页面</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#常见错误"><span class="nav-text">常见错误</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#最后"><span class="nav-text">最后</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2015 - 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">willxue</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>

  
  <script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.0"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  


  




	





  





  





  




  
    <script type="text/javascript">
    (function(){
      var appid = 'cysUrBDmO';
      var conf = 'c41ca3e91546e81c9c07a9e0e35caacd';
      var width = window.innerWidth || document.documentElement.clientWidth;
      if (width < 960) {
      window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){
        window.changyan.api.config({appid:appid,conf:conf})});
      }
    })();
    </script>
    <script type="text/javascript" src="https://assets.changyan.sohu.com/upload/plugins/plugins.count.js"></script>
  



  





  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
  <script>AV.initialize("QImiFijLSOHYufsazlBVlwLg-gzGzoHsz", "AMcYaNHy9Y5OdH42k0d4uSED");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  

  

  

</body>
</html>
